const filterRoutes = (arr, roleList) => {
    const routesArr = []
    arr.forEach(item => {
      if (roleList.includes(item['name'])) {
        if (item['children']) {
          item['children'] = filterRoutes(item['children'], roleList)
        }
        routesArr.push(item)
      }
    })
    return routesArr
  }
  
  const getSysName = (pathStr) => {
    let pathArr = pathStr.split('/');
    let systemName = pathArr.includes('layout') ? null : pathArr[1];
    return systemName
  }
  
  export { filterRoutes, getSysName }